package edu;

//员工题目训练
import java.sql.SQLOutput;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int ms = scan.nextInt();
        Manager m = new Manager(ms);


        int ss = scan.nextInt();
        int se = scan.nextInt();
        Salesman s = new Salesman(ss, se);

        int sw = scan.nextInt();
        int sd = scan.nextInt();
        Worker w = new Worker(sw, sd);
        System.out.println(s.getSalary());
        System.out.println(m.getSalary());
        System.out.println(w.getSalary());
    }
}

class employee {
    private int salary;

    public employee(int salary) {
        this.salary = salary;
    }

    public int getSalary() {
        return salary;
    }
}

class Manager extends employee {


    public Manager(int salary) {
        super(salary);
    }

    public int getSalary() {

        return super.getSalary();
    }
}


class Salesman extends employee {
    private int extra;

    public Salesman(int salary, int extra) {
        super(salary);
        this.extra = extra;
    }

    public int getSalary() {
        return super.getSalary() + this.extra;
    }
}

class Worker extends employee {
    private int day;

    public Worker(int salary, int day) {
        super(salary);
        this.day = day;
    }

    public int getSalary() {
        return super.getSalary() * this.day;
    }
}
